<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
 * This is a sample module for PyroCMS
 *
 * @author 		Jerel Unruh - PyroCMS Dev Team
 * @website		http://unruhdesigns.com
 * @package 	PyroCMS
 * @subpackage 	Sample Module
 */
class Admin extends Admin_Controller
{
	public function __construct()
	{
		parent::__construct();

		$this->load->model('dataman_m');
		$this->lang->load('dataman');
		realTimeProc();
		$this->template->set_partial('shortcuts', 'admin/partials/shortcuts')
						->append_metadata(js('admin.js', 'dataman'))
						->append_metadata(js('jquery.form.js', 'dataman'))
						->append_metadata(js('helper.js', 'dataman'))
						->append_metadata(css('admin.css', 'dataman'))
						->append_metadata(css('jquery-ui.css', 'dataman'))
						->append_metadata(js('jscal/src/js/jscal2.js', 'dataman'))
						->append_metadata(js('jscal/src/js/lang/en.js', 'dataman'))
						->append_metadata(css('jscal/src/css/jscal2.css', 'dataman'))
						->append_metadata(css('jscal/src/css/steel/steel.css', 'dataman'))
						;
	}

	public function index()
	{
		$this->template->title($this->module_details['name'])->build('admin/items', $this->data);
	}
	
	function coupon(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('coupon.js', 'dataman'));
		$this->load->model('coupon_m');
		switch($route){
			default:
			case 'pending':
				$this->data->items = $this->coupon_m->pending(); 
				$this->template
					->build('admin/coupon/pending', $this->data);
				break;
			case 'redeem':
				$this->data->items = $this->coupon_m->redeem(); 
				$this->template
					->build('admin/coupon/redeem', $this->data);
				break;
			case 'add_coupon':
				$this->load->view('admin/coupon/add_coupon');
				break;
			case 'add_coupon_submit':
				$this->coupon_m->coupon_submit();
				break;
			case 'delete_coupon':
				$this->coupon_m->delete_coupon();
				break;
			case 'view_users':
				$this->load->view('admin/coupon/users_redeem_coupon');
				break;
		}		
	}
	
	function user(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('user.js', 'dataman'));
		$this->load->model('user_m');
		switch($route){
			default:
			case 'listall':
				$this->data->items = $this->user_m->listall(); 
				$this->template
					->build('admin/user/listall', $this->data);
				break;
			case 'search':
				$this->data->items = $this->user_m->search(); 
				$this->template
					->build('admin/user/listall', $this->data);
				break;
			case 'change_user_status':
				$this->user_m->change_user_status();
				break;
			case 'edit':
				$this->load->view('admin/user/edit_information');
				break;
			case 'edit_submit':
				$this->user_m->edit_submit();
				break;	
			case 'show_shipping_info':
				$this->user_m->show_shipping_info();
				break;
			case 'delete_user':
				$this->user_m->delete_user();
				break;
		}	
	}
	
	function general(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('general.js', 'dataman'));
		$this->load->model('general_m');
		switch($route){
			default:
			case 'sport':
				$this->template
					->build('admin/general/list_sport');
				break;
			case 'add_sport':
				$this->load->view('admin/general/sport_add_edit');
				break;	
			case 'add_sport_submit':
				$this->general_m->add_sport_submit();
				break;
			case 'edit_sport':
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/general/sport_add_edit',$this->data);
				break;
			case 'edit_sport_submit':
				$this->general_m->edit_sport_submit();
				break;	
			case 'team':
				$this->template
					->build('admin/general/list_team');
				break;
			case 'add_team':
				$this->load->view('admin/general/team_add_edit');
				break;
			case 'add_team_submit':
				$this->general_m->add_team_submit();
				break;
			case 'edit_team':
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/general/team_add_edit',$this->data);
				break;
			case 'edit_team_submit':
				$this->general_m->edit_team_submit();
				break;
			case 'currency':
				$this->template
					->build('admin/general/list_currency');
				break;
			case 'add_currency':
				$this->load->view('admin/general/add_edit_currency');
				break;
			case 'edit_currency':
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/general/add_edit_currency', $this->data);
				break;
			case 'currency_submit':
				$this->general_m->currency_submit();
				break;
			case 'currency_delete':
				$this->general_m->currency_delete();
				break;
			case 'coin_packages':
				$this->template
					->build('admin/general/list_coin_packages');
				break;
			case 'add_coin_packages':
				$this->load->view('admin/general/add_coin_packages');
				break;
			case 'add_coin_packages_submit':
				$this->general_m->add_coin_packages_submit();
				break;
			case 'coin_package_delete':
				$this->general_m->coin_package_delete();
				break;
			case 'default_events':
				$this->template
					->build('admin/general/default_events');
				break;
			case 'add_category':
				$this->load->view('admin/general/add_edit_category');
				break;
			case 'add_edit_category_submit':
				$this->general_m->add_edit_category_submit();
				break;
			case 'delete_default_category':
				$this->general_m->delete_default_category();
				break;
			case 'add_event':
				$this->load->view('admin/general/add_edit_event');
				break;
			case 'add_edit_event_submit':
				$this->general_m->add_edit_event_submit();
				break;
			case 'delete_default_event':
				$this->general_m->delete_default_event();
				break;
			case 'auction_credits':
				$this->template
					->build('admin/general/auction_credits_list');
				break;
			case 'edit_coin_auction';	
			case 'add_coin_auction':
				$this->load->view('admin/general/add_edit_coin_auction');
				break;
			case 'auction_coin_submit':
				$this->general_m->auction_coin_submit();
				break;
			case 'auction_coin_delete':
				$this->general_m->auction_coin_delete();
				break;
			case 'setting':
				$this->template
					->build('admin/general/setting');
				break;
			case 'setting_submit':
				$this->general_m->setting_submit();
				break;
			case 'reset_coins':
				$this->general_m->reset_coins();
				break;
		}	
	}
	
	function tournament(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('tournament.js', 'dataman'));
		$this->template->append_metadata(js('manual_event_tournament.js', 'dataman'));
		$this->load->model('tournament_m');
		switch($route){
			default:
			case 'live':
				$this->template
					->append_metadata( $this->load->view('fragments/wysiwyg', $this->data, TRUE) )
					->build('admin/tournament/live_tournament');
				break;
			case 'upcoming':
				$this->template
					->append_metadata( $this->load->view('fragments/wysiwyg', $this->data, TRUE) )
					->build('admin/tournament/upcoming_tournament');
				break;
			case 'closed':
				$this->template
					->build('admin/tournament/closed_tournament');
				break;
			case 'cancelled':
				$this->template
					->build('admin/tournament/cancelled_tournament');
				break;	
			case 'unpublish':
				$this->template
					->build('admin/tournament/unpublish_tournament');
				break;
			case 'add_new_tournament': // deprecated
				$this->load->view('admin/tournament/add_edit_tournament');
				break;
			case 'tournament_submit':
				$this->tournament_m->tournament_submit();
				break;
			case 'edit_tournament': // deprecated
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/tournament/add_edit_tournament',$this->data);
				break;
			case 'add_prize':
				$this->data->tournament_id = intval($_POST['tournament_id']);
				$this->load->view('admin/tournament/add_edit_prize',$this->data);
				break;
			case 'prize_submit':
				$this->tournament_m->prize_submit();
				break;
			case 'view_prize':
				$this->data->tournament_id = intval($_POST['tournament_id']);
				$this->load->view('admin/tournament/list_prize',$this->data);
				break;
			case 'edit_prize':
				$this->data->id = intval($_POST['p_id']);
				$this->load->view('admin/tournament/add_edit_prize',$this->data);
				break;
			case 'delete_prize':
				$this->tournament_m->delete_prize();
				break;
			case 'publish_unpublish':
				$this->tournament_m->publish_unpublish();
				break;
			case 'tournament_cancel':
				$this->tournament_m->tournament_cancel();
				break;
			case 'rank_view':
				$this->load->view('admin/tournament/rank_view');
				break;
			case 'tournament_finish':
				$this->tournament_m->tournament_finish();
				break;
		}		
	}
	
	function tournament_event(){
		$route = $this->uri->segment(4,'');
		$this->load->model('tournament_event_m');
		switch($route){
			default:
			case 'view_event': // living/upcoming event
				$this->load->view('admin/tournament/event/view_event');
				break;
			case 'view_event_closed':
				$this->load->view('admin/tournament/event/view_event_closed');
				break;
			case 'view_event_cancelled':
				$this->load->view('admin/tournament/event/view_event_cancelled');
				break;
			case 'view_event_hidden_category':	
				$this->load->view('admin/tournament/event/view_event_hidden_category');
				break;
			case 'add_category_event':
			case 'event_category_edit':
				$this->load->view('admin/tournament/event/add_category_event');
				break;
			case 'add_event':
			case 'edit_event':
				$this->load->view('admin/tournament/event/add_new_event' );
				break;
			case 'ordering_category':
				$this->load->view('admin/tournament/event/ordering_category');
				break;	
			case 'add_events_to_category':
				$this->load->view('admin/tournament/event/add_events_to_category');
				break;
			case 'add_more_event':
				$this->load->view('admin/tournament/event/add_more_event_async');
				break;
			case 'edit_all_events_of_category':
				$this->load->view('admin/tournament/event/edit_all_events_of_category');
				break;
			case 'who_bet_event':
				$this->load->view('admin/tournament/event/who_bet_event', $this->data);
				break;
			case 'event_category_open_hide':
				$this->tournament_event_m->event_category_open_hide();
				break;
			case 'event_category_submit':	
				$this->tournament_event_m->event_category_submit();
				break;
			case 'event_submit':
				$this->tournament_event_m->event_submit();
				break;
			case 'event_change_bet_status':
				$this->tournament_event_m->event_change_bet_status();
				break;
			case 'set_event_result':
				$this->tournament_event_m->set_event_result();
				break;
			case 'update_ordering_category':
				$this->tournament_event_m->update_ordering_category();
				break;
			case 'add_events_submit':
				$this->tournament_event_m->add_events_submit();
				break;
			case 'edit_events_submit':
				$this->tournament_event_m->edit_events_submit();
				break;
			case 'event_cancel':
				$this->tournament_event_m->event_cancel();
				break;
			case 'event_finish':
				$this->tournament_event_m->event_finish();
				break;
			case 'event_category_cancel':
				$this->tournament_event_m->event_category_cancel();
				break;
			case 'event_category_finish':
				$this->tournament_event_m->event_category_finish();
				break;	
		}	
	}
	
	function manual_tournament(){
		$route = $this->uri->segment(4,'');
		$this->load->model('manual_event_tournament_m');
		switch($route){
			default:  
			case 'show_living_event':
				$this->load->view('admin/tournament/manual/living_event');
				break;	
			case 'view_manual_event_closed':
				$this->load->view('admin/tournament/manual/closed_event');
				break;	
			case 'view_manual_event_cancelled':
				$this->load->view('admin/tournament/manual/cancelled_event');
				break;	
			case 'view_manual_event_hidden':
				$this->load->view('admin/tournament/manual/view_manual_event_hidden');
				break;	
			case 'add_category':
				$this->load->view('admin/tournament/manual/add_category');
				break;
			case 'add_new_category_submit':
				$this->manual_event_tournament_m->add_new_category_submit();
				break;
			case 'edit_category':
				$this->load->view('admin/tournament/manual/edit_category');
				break;
			case 'edit_category_submit':
				$this->manual_event_tournament_m->edit_category_submit();
				break;
			case 'change_manual_category_open_hide':
				$this->manual_event_tournament_m->change_manual_category_open_hide();
				break;
			case 'manual_event_manage':
				$this->load->view('admin/tournament/manual/manual_event_manage');
				break;
			case 'set_bet_manual_event_result':
				$this->manual_event_tournament_m->set_bet_manual_event_result();
				break;
			case 'bet_manual_event_finish':
				$this->manual_event_tournament_m->bet_manual_event_finish();
				break;
			case 'bet_manual_event_cancel':
				$this->manual_event_tournament_m->bet_manual_event_cancel();
				break;
			case 'manual_category_finish':
				$this->manual_event_tournament_m->manual_category_finish();
				break;
			case 'manual_category_cancel':	
				$this->manual_event_tournament_m->manual_category_cancel();
				break;
			case 'manual_category_set_answer':
				$this->load->view('admin/tournament/manual/manual_category_set_answer');
				break;
			case 'manual_category_set_answer_submit':
				$this->manual_event_tournament_m->manual_category_set_answer_submit();
				break;
			case 'apply_answer_to_category':
				$this->manual_event_tournament_m->apply_answer_to_category();
				break;
			case 'apply_answer_to_all_category_of_match':
				$this->manual_event_tournament_m->apply_answer_to_all_category_of_match();
				break;
		}
	}	
	
	function match(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('match.js', 'dataman'));
		$this->template->append_metadata(js('manual_event.js', 'dataman'));
		$this->load->model('match_m');
		switch($route){
			default:
			case 'show':
				$this->data->items = $this->match_m->search();
				$this->template->title($this->module_details['name'])
						->build('admin/match/show', $this->data);
				break;	
			case 'in_tournament':
				$this->data->tournament_id = intval($_GET['t_id']);
				$this->template
					->build('admin/match/list_match_in_tournament', $this->data);
				break;
			case 'add_new_match':
				$this->data->tournament_id = intval($_POST['tournament_id']);
				$this->load->view('admin/match/add_new_match', $this->data);
				break;
			case 'match_submit':
				$this->match_m->match_submit();
				break;
			case 'edit_match':
				$this->data->tournament_id = intval($_POST['tournament_id']);
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/match/add_new_match', $this->data);
				break;
			case 'change_bet_status_match':
				$this->match_m->change_bet_status_match();
				break;
			case 'add_category_event':
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/add_category_event', $this->data);
				break;
			case 'event_category_submit':
				$this->match_m->event_category_submit();
				break;
			case 'view_category_event':
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/view_category_event', $this->data);
				break;
			case 'event_category_edit':
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/match/add_category_event', $this->data);
				break;
			case 'add_event':
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/add_new_event', $this->data);
				break;
			case 'event_submit':
				$this->match_m->event_submit();
				break;	
			case 'view_event': // living/upcoming event
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/view_event', $this->data);
				break;
			case 'view_event_closed': //close event
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/view_event_closed', $this->data);
				break;
			case 'view_event_cancelled': //cancelled event
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/view_event_cancelled', $this->data);
				break;
			case 'view_event_hidden_category': // hidden category
				$this->data->match_id = intval($_POST['match_id']);
				$this->load->view('admin/match/view_event_hidden_category', $this->data);
				break;
			case 'event_change_bet_status':	
				$this->match_m->event_change_bet_status();
				break;
			case 'edit_event':
				$this->data->match_id = intval($_POST['match_id']);
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/match/add_new_event', $this->data);
				break;
			case 'set_event_result':
				$this->match_m->set_event_result();
				break;
			case 'who_bet_event':
				$this->data->id = intval($_POST['id']);
				$this->load->view('admin/match/who_bet_event', $this->data);
				break;
			case 'match_finish':
				$this->match_m->match_finish();
				break;
			case 'event_finish':
				$this->match_m->event_finish();
				break;
			case 'event_cancel':
				$this->match_m->event_cancel();
				break;
			case 'event_category_cancel':
				$this->match_m->event_category_cancel();
				break;
			case 'event_category_finish':	
				$this->match_m->event_category_finish();
				break;	
			case 'match_cancel':
				$this->match_m->match_cancel();
				break;
			case 'add_events_to_category':
				$this->load->view('admin/match/add_events_to_category');
				break;
			case 'add_more_event':
				$this->load->view('admin/match/add_more_event_async');
				break;
			case 'add_events_submit':
				$this->match_m->add_events_submit();
				break;
			case 'edit_all_events_of_category':
				$this->load->view('admin/match/edit_all_events_of_category');
				break;
			case 'edit_events_submit':
				$this->match_m->edit_events_submit();
				break;
			case 'ordering_category':	
				$this->load->view('admin/match/ordering_category');
				break;
			case 'update_ordering_category':
				$this->match_m->update_ordering_category();
				break;
			case 'event_category_open_hide':
				$this->match_m->event_category_open_hide();
				break;
			case 'match_show_feature':
				$this->match_m->match_show_feature();
				break;
			case 'batsman':
				$this->load->view('admin/match/batsman');
				break;
			case 'batsman_submit':
				$this->match_m->batsman_submit();
				break;
			case 'scorecard_view':
				$this->load->view('admin/match/scorecard_view');
				break;
			case 'scorecard_add_item':
				$this->load->view('admin/match/scorecard_add_item');
				break;
			case 'scorecard_add_submit':
				$this->match_m->scorecard_add_submit();
				break;
			case 'score_item_delete':
				$this->match_m->score_item_delete();
				break;
			case 'remove_xml_match_update':
				$this->match_m->remove_xml_match_update();
				break;
		}		
	}
	
	function manual_event(){
		$route = $this->uri->segment(4,'');
		$this->load->model('manual_event_m');
		switch($route){
			default:  
			case 'show_living_event':
				$this->load->view('admin/match/manual/living_event');
				break;	
			case 'view_manual_event_closed':
				$this->load->view('admin/match/manual/closed_event');
				break;	
			case 'view_manual_event_cancelled':
				$this->load->view('admin/match/manual/cancelled_event');
				break;	
			case 'view_manual_event_hidden':
				$this->load->view('admin/match/manual/view_manual_event_hidden');
				break;	
			case 'add_category':
				$this->load->view('admin/match/manual/add_category');
				break;
			case 'add_new_category_submit':
				$this->manual_event_m->add_new_category_submit();
				break;
			case 'edit_category':
				$this->load->view('admin/match/manual/edit_category');
				break;
			case 'edit_category_submit':
				$this->manual_event_m->edit_category_submit();
				break;
			case 'change_manual_category_open_hide':
				$this->manual_event_m->change_manual_category_open_hide();
				break;
			case 'manual_event_manage':
				$this->load->view('admin/match/manual/manual_event_manage');
				break;
			case 'set_bet_manual_event_result':
				$this->manual_event_m->set_bet_manual_event_result();
				break;
			case 'bet_manual_event_finish':
				$this->manual_event_m->bet_manual_event_finish();
				break;
			case 'bet_manual_event_cancel':
				$this->manual_event_m->bet_manual_event_cancel();
				break;
			case 'manual_category_finish':
				$this->manual_event_m->manual_category_finish();
				break;
			case 'manual_category_cancel':	
				$this->manual_event_m->manual_category_cancel();
				break;
			case 'manual_category_set_answer':
				$this->load->view('admin/match/manual/manual_category_set_answer');
				break;
			case 'manual_category_set_answer_submit':
				$this->manual_event_m->manual_category_set_answer_submit();
				break;
			case 'apply_answer_to_category':
				$this->manual_event_m->apply_answer_to_category();
				break;
			case 'apply_answer_to_all_category_of_match':
				$this->manual_event_m->apply_answer_to_all_category_of_match();
				break;
		}
	}	
	
	function subscriptions(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('subscriptions.js', 'dataman'));
		$this->load->model('subscriptions_m');
		switch($route){
			default:
			case 'email_subscription':
				$this->data->items = $this->subscriptions_m->email_subs_users();
				$this->template->title($this->module_details['name'])
						->build('admin/subscriptions/email_subs_users', $this->data);
				break;	
			case 'sms_subscription':
				$this->data->items = $this->subscriptions_m->sms_subscription_users();
				$this->template->title($this->module_details['name'])
						->build('admin/subscriptions/sms_subscription', $this->data);
				break;	
			case 'add_new_user_email_subs':
				$this->load->view('admin/subscriptions/add_new_user_email_subs' );
				break;
			case 'add_new_user_sms_subs':
				$this->load->view('admin/subscriptions/add_new_user_sms_subs' );
				break;
			case 'email_subs_submit':
				$this->subscriptions_m->email_subs_submit();
				break;
			case 'sms_subs_submit':
				$this->subscriptions_m->sms_subs_submit();
				break;
			case 'unsubscription_user_email':
				$this->subscriptions_m->unsubscription_user_email();
				break;
			case 'unsubscription_user_sms':
				$this->subscriptions_m->unsubscription_user_sms();
				break;
			case 'email_compose':	
				$this->data->items = $this->subscriptions_m->email_compose();
				$this->template->title($this->module_details['name'])
						->build('admin/subscriptions/email_compose', $this->data);
				break;	
			case 'sms_compose':	
				$this->data->items = $this->subscriptions_m->sms_compose();
				$this->template->title($this->module_details['name'])
						->build('admin/subscriptions/sms_compose', $this->data);
				break;		
			case 'email_compose_form':
				$this->template
					->append_metadata( $this->load->view('fragments/wysiwyg', $this->data, TRUE) )
					->build('admin/subscriptions/email_compose_form');
				break;
			case 'sms_compose_form':
				$this->template->title($this->module_details['name'])
						->build('admin/subscriptions/sms_compose_form');
				break;	
			case 'email_compose_form_submit':
				$this->subscriptions_m->email_compose_form_submit();
				break;
			case 'sms_compose_form_submit':
				$this->subscriptions_m->sms_compose_form_submit();
				break;
			case 'sms_compose_form_send':
				$this->subscriptions_m->sms_compose_form_send();
				break;
			case 'email_compose_form_send':
				$this->subscriptions_m->email_compose_form_send();
				break;
			case 'send_email':
				$this->subscriptions_m->send_email();
				break;
			case 'send_sms':
				$this->subscriptions_m->send_sms();
				break;
			case 'delete_email':
				$this->subscriptions_m->delete_email();
				break;
			case 'delete_sms':
				$this->subscriptions_m->delete_sms();
				break;
		}	
	}
	
	function payment(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('jquery.popupWindow.js', 'dataman'));
		$this->template->append_metadata(js('payment.js', 'dataman'));
		
		$this->load->model('payment_m');
		switch($route){
			default:
			case 'offline_payment': //pending
				$this->data->items = $this->payment_m->offline_payment();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/offline_payment_list', $this->data);
				break;	
			case 'offline_payment2':// approved
				$this->data->items = $this->payment_m->offline_payment_approved();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/offline_payment_approved_list', $this->data);
				break;	
			case 'online_payment':
				$this->data->items = $this->payment_m->online_payment();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/online_payment', $this->data);
				break;	
			case 'approve_payment':
				$this->payment_m->approve_payment();
				break;
			case 'delete_payment':
				$this->payment_m->delete_payment();
				break;
			case 'view_edit_payment':
				$this->load->view('admin/payment/view_edit_payment' );
				break;
			case 'edit_payment_submit':
				$this->payment_m->edit_payment_submit();
				break;
			case 'cod':
				$this->data->items = $this->payment_m->cod_pending();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/cod_pending', $this->data);
				break;	
			case 'cod_completed':
				$this->data->items = $this->payment_m->cod_completed();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/cod_completed', $this->data);
				break;
			case 'cod_cancelled':
				$this->data->items = $this->payment_m->cod_completed();
				$this->template->title($this->module_details['name'])
						->build('admin/payment/cod_cancelled', $this->data);
				break;
			case 'approve_cod_item':
				$this->payment_m->approve_cod_item();
				break;
			case 'cancel_cod_item':
				$this->payment_m->cancel_cod_item();
				break;
			case 'dispatch_cod_item':
				$this->payment_m->dispatch_cod_item();
				break;
			case 'print':
				$this->load->view('admin/payment/print' );
				break;
		}		
	}
	
	function history(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('history.js', 'dataman'));
		$this->load->model('history_m');
		switch($route){
			default:
			case 'convertion': //
				$this->data->items = $this->history_m->convertion();
				$this->template->title($this->module_details['name'])
						->build('admin/history/convertion_list', $this->data);
				break;	
			case 'bet': //
				$this->data->items = $this->history_m->bet();
				$this->template->title($this->module_details['name'])
						->build('admin/history/bet_list', $this->data);
				break;		
			case 'bet_manual':
				$this->data->items = $this->history_m->bet_manual();
				$this->template->title($this->module_details['name'])
						->build('admin/history/bet_manual', $this->data);
				break;	
			case 'tournament_bet':
				$this->data->items = $this->history_m->tournament_bet();
				$this->template->title($this->module_details['name'])
						->build('admin/history/tournament_bet', $this->data);
				break;	
			case 'tournament_bet_manual':
				$this->data->items = $this->history_m->tournament_bet_manual();
				$this->template->title($this->module_details['name'])
						->build('admin/history/tournament_bet_manual', $this->data);
				break;	
		}		
	}
	
	function advertising(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('advertising.js', 'dataman'));
		$this->load->model('advertising_m');
		switch($route){
			default:
			case 'list_advertising': //
				$this->template->title($this->module_details['name'])
						->build('admin/advertising/list_advertising');
				break;	
			case 'add':
			case 'edit':
				$this->load->view('admin/advertising/add_edit' );
				break;
			case 'add_edit_submit':
				$this->advertising_m->add_edit_submit();
				break;
			case 'delete':
				$this->advertising_m->delete();
				break;
			case 'change_status':
				$this->advertising_m->change_status();
				break;
		}		
	}
	
	function feed(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('feed.js', 'dataman'));
		$this->load->model('feed_m');
		switch($route){
			default:
			case 'team_explore': //
				$this->template->title($this->module_details['name'])
						->build('admin/feed/team_explore');
				break;
			case 'browser':	
				$this->template->title($this->module_details['name'])
						->build('admin/feed/browser');
				break;
			case 'parser':	
				$this->template->title($this->module_details['name'])
						->build('admin/feed/parser');
				break;
			case 'viewInning':
				$this->load->view('admin/feed/async/viewInning' );
				break;
			case 'viewComment':
				$this->load->view('admin/feed/async/viewComment' );
				break;
			case 'viewWicket':
				$this->load->view('admin/feed/async/viewWicket' );
				break;
			case 'viewLineup':
				$this->load->view('admin/feed/async/viewLineup' );
				break;
			case 'viewMatchInfo':
				$this->load->view('admin/feed/async/viewMatchInfo' );
				break;
			case 'addMatch':
				$this->load->view('admin/feed/async/addMatch' );
				break;
			case 'clearCacheTeam':
				$this->feed_m->clearCacheTeam();
				break;
			case 'match_submit':
				$this->feed_m->match_submit();
				break;
		}	
	}
	
	function weekly_prize(){
		$route = $this->uri->segment(4,'');
		$this->template->append_metadata(js('weekly_prize.js', 'dataman'));
		$this->load->model('weekly_prize_m');
		switch($route){
			default:
			case 'list':
				$this->template
					->build('admin/tournament/weekly_prize/list');
				break;
			case 'add_category':
				$this->load->view('admin/tournament/weekly_prize/add_edit_category_form');
				break;
			case 'prize_view_manage':
				$this->load->view('admin/tournament/weekly_prize/prize_view_manage');
				break;
			case 'add_edit_prize':
				$this->load->view('admin/tournament/weekly_prize/add_edit_prize');
				break;
			case 'category_submit':
				$this->weekly_prize_m->category_submit();
				break;
			case 'changeEnablePrizeCate':
				$this->weekly_prize_m->changeEnablePrizeCate();
				break;
			case 'prize_submit':
				$this->weekly_prize_m->prize_submit();
				break;
			case 'prize_delete':
				$this->weekly_prize_m->delete_prize();
				break;
			case 'finishWeeklyPrize':
				$this->weekly_prize_m->finishWeeklyPrize();
				break;
		}
	}
	//end class
}
